<!DOCTYPE HTML>
<html>
<head>
    <title>职业列表</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <a class="mini-button" onclick="onOk" iconCls="fa-save" plain="true">确定</a>
                <a class="mini-button" onclick="onCancel" iconCls="fa fa-close" plain="true">关闭</a>
                <span class="separator"></span>
            </td>
            <td style="white-space:nowrap;">
                <input id="key" class="mini-textbox" emptyText="请输入职业名称" style="width:200px;"
                       onenter="onKeyEnter" />
                <a class="mini-button" iconCls="fa fa-search" plain="true" onclick="search">查询</a>
            </td>
        </tr>
    </table>
</div>
<div allowSortColumn="false" allowMoveColumn="false" allowResizeColumn="false" style="width:100%;height:440px;"
     id="datagrid1" class="mini-datagrid" idField="id" showPager="true"
     pageSize="10" ajaxType="get" url="/azbj/inmates/sentence/syscode/zuiming?codeType=2_8">
    <div property="columns">
        <div type="indexcolumn" width="40">序号</div>
        <div field="codeId" width="100" headerAlign="center" allowSort="true" class="mini-hidden" allowSortColumn="false">职业编码</div>
        <div field="codeName" width="340" headerAlign="center" allowSort="true">职业名称</div>
    </div>
</div>

<script type="text/javascript">
    mini.parse();
    var grid = mini.get("datagrid1");
    grid.load();

    function search() {
        var key = mini.get("key").getValue();
        grid.load({queryKey: key});
    }

    function onKeyEnter(e) {
        search();
    }

    /*无需实现*/
    function SetData() {

    }

    // 获取项目的名称
    function GetData() {
        var selected = grid.getSelected();
        var data = {codeName: selected.codeName, codeId: selected.codeId};
        return data;
    }

    function onOk() {
        CloseWindow("ok");
    }

    function onCancel() {
        CloseWindow("cancel");
    }

    function CloseWindow(action) {
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) {
            return window.CloseOwnerWindow(action);
        } else {
            window.close();
        }
    }
</script>
</body>
</html>